<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<style type="text/css">
		
		.con{
			width: 400px;
			height: 400px;
			border: 1px solid #000;
			margin: 50px auto 0px;
			position: relative;
		}

		.box1,.box2{
			width: 300px;
			height: 100px;
			margin: 10px;
		}

		.box1{
			background-color: pink;

			/*相对定位relative: 相对于自身进行定位,保留自身原先位置;
			position: relative;
			left: 50px; 
			top: 50px;*/

			/*绝对定位absolute:脱离文档流,根据自己位置向上找父级,若父级有定位属性,就以其为参照进行定位,直到body
			position: absolute;
			left: 50px; 
			top: 50px;*/

			/*固定定位fixed: 根据浏览器窗口进行定位*/
			position: fixed;
			left: 50px; 
			top: 50px;

		}

		.box2{
			background-color: red;
		}


	</style>
</head>
<body>
	<div class="con">
		<div class="box1"></div>
		<div class="box2"></div>
	</div>
</body>
</html>